﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using PMPUtils.DB;

namespace PMPUtils.Report
{
    public class WeeklyUpdateOperator
    {
        /// <summary>
        /// Read the weekly update based on the sprint
        /// </summary>
        /// <param name="sprint"></param>
        /// <returns></returns>
        public static DataTable ReadWeeklyUpdate(String sprint)
        {
            String strQuery = " select team, goal, task_id Story, goalpriority.name Priority, goalstatus.name Progress, status, orig_est, rem_est " +
                " from goals " +
                " join goalpriority " +
                " on (goalpriority.id = goals.priority) " +
                " join goalstatus " +
                " on (goalstatus.id = goals.progress) " +
                " where rev is null and sprint = " + sprint +
                " order by team, priority, goal, Story";

            DBOperator dbOperator = new DBOperator(DBConfigurations.LOCAL_CONNECTION_STRING);
            DataTable dtWeeklyUpdate = dbOperator.Read(strQuery);

            return dtWeeklyUpdate;
        }
    }
}
